package wt.hpad.activity.order;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import wt.hpad.R;
import wt.hpad.base.BaseFragment;
import wt.hpad.model.adapter.DishOrderAdapter;
import wt.hpad.model.bean.Dish;
import wt.hpad.utils.RCViewUtil;

/**
 * Created by wt on 12.26.
 */

public class OrderFragment extends BaseFragment {
    @BindView(R.id.rv_order)
    RecyclerView rvOrder;
    Unbinder unbinder;
    private List<Dish> mDataSource;
    private DishOrderAdapter mAdapter;


    public void setDataSource(List<Dish> dishes) {
        mDataSource = dishes;
    }


    @Override
    public View initViews() {
        View view = LayoutInflater.from(baseActivity).inflate(R.layout.order_frag, null);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void initData() {
        RCViewUtil.init_LinearLayout(rvOrder);
        mAdapter = new DishOrderAdapter(mDataSource, getActivity());
        rvOrder.setAdapter(mAdapter);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
